package realtime.util;

import org.apache.flink.streaming.api.functions.windowing.AllWindowFunction;
import org.apache.flink.streaming.api.windowing.windows.Window;
import org.apache.flink.util.Collector;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class MyWindowFunctionImplementParent<IN, OUT, W extends Window> implements AllWindowFunction<IN, OUT, W> {

    @Override
    public void apply(W window, Iterable<IN> values, Collector<OUT> out) throws Exception {
        IN next = values.iterator().next();
        Class<?> clz = next.getClass();
        Field stt = clz.getDeclaredField("stt");
        stt.setAccessible(true);

        Class<? extends Window> windowClass = window.getClass();
        Method getStart = windowClass.getDeclaredMethod("getStart");
        Method getEnd = windowClass.getDeclaredMethod("getEnd");
        getStart.setAccessible(true);
        getEnd.setAccessible(true);




//        stt.set(next,DateFormatUtil.toYmdHms(window.));
}
}
